package com.soul.net.http;

import com.soul.net.Response;

import java.util.HashMap;
import java.util.Map;

/**
 * 响应类
 */
public class HttpResponse implements Response {
    
    private int statusCode;
    private Map<String,String> headers;
    private boolean isStream;
    private String content;
    private byte[] bytes;
    
    public HttpResponse(){
        this.headers = new HashMap<>();
        this.isStream = false;
    }

    public int getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    }

    public Map<String, String> getHeaders() {
        return headers;
    }

    public void setHeaders(Map<String, String> headers) {
        this.headers = headers;
    }
    
    public void putHeader(String key,String value){
        if (key != null && value != null){
            this.headers.put(key,value);
        }
    }

    public boolean isStream() {
        return isStream;
    }

    public void setStream(boolean stream) {
        isStream = stream;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public byte[] getBytes() {
        return bytes;
    }

    public void setBytes(byte[] bytes) {
        this.bytes = bytes;
    }
}
